<?php

include_once($_SERVER['DOCUMENT_ROOT'] . "/RecJP/class/Model/Model.user.php");
include_once($_SERVER['DOCUMENT_ROOT'] . "/RecJP/class/class.UserManagement.php");

$user = new Model_user();
$user->email = $_POST["uname"];
$user->username = $_POST["uname"];
$user->password = md5($_POST["upwd"]);
$user->ip = $_SERVER["REMOTE_ADDR"];
$user->createtime = date("Y-m-d H:i:s");
$um = new UserManagement();
$arr = array();
header('Content-type: application/json');

if (strtoupper($_POST["captcha"]) != strtoupper($_SESSION["Captcha"])) {
    $arr["returnvalue"] = "验证码错误";
} else {
    
    $r = $um->CreateUser($user);
    $arr["returnvalue"] = $r;
}

echo json_encode($arr);